<?php

namespace App\Http\Controllers\Api\v2;

use App\Http\Controllers\ApiController;
use App\Models\District;

class DistrictController extends ApiController
{
    /**
     * @return \Illuminate\Http\JsonResponse
     */
    public function get(){
        $id = intval($this->request->input('id'));
        return ajaxReturn(['district'=>District::find($id)]);
    }

    /**
     * @return \Illuminate\Http\JsonResponse
     */
    public function getDistrictList(){
        $fid = intval($this->request->input('fid'));
        $items = District::where('fid', $fid)->orderBy('displayorder')->get();
        return ajaxReturn(['items'=>$items]);
    }
}
